package com.amigo.online.provider.manager.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.amigo.online.provider.manager.mapper.AdvAreaTblMapper;
import com.amigo.online.provider.manager.model.entity.AdvAreaTbl;
import com.amigo.online.provider.manager.result.AdvAreaTblInfo;
import com.amigo.online.provider.manager.service.AdvAreaTblService;

@Service
public class AdvAreaTblServiceImpl implements AdvAreaTblService {

    @Resource
    private AdvAreaTblMapper areaMapper;

    @Override
    public List<AdvAreaTbl> findAdvAreaTbl(AdvAreaTbl aat) {

        return areaMapper.findAdvAreaTbl(aat);
    }

    @Override
    public boolean insertionAdvAreaTbl(AdvAreaTbl aat) {
        aat.setCreatedTime(System.currentTimeMillis() / 1000);
        int i = areaMapper.insertionAdvAreaTbl(aat);

        if (i <= 0) {
            return false;
        } else {

            return true;
        }

    }

    @Override
    public boolean updateAdvAreaTbl(AdvAreaTbl aat) {
        aat.setUpdatedTime(System.currentTimeMillis() / 1000);
        int i = areaMapper.updateAdvAreaTbl(aat);
        if (i <= 0) {
            return false;
        } else {

            return true;
        }
    }

    @Override
    public boolean deleteAdvAreaTbl(AdvAreaTbl aat) {
        aat.setDeleted(1);
        aat.setDeletedTime(System.currentTimeMillis() / 1000);
        int i = areaMapper.deleteAdvAreaTbl(aat);
        if (i <= 0) {
            return false;
        } else {
            return true;
        }
    }

    @Override
    public List<AdvAreaTblInfo> selectAdvAreaTblInfo(AdvAreaTbl advAreaTblInfo) {
        return areaMapper.selectAdvAreaTblInfo(advAreaTblInfo);
    }

}
